var sysBusLogModule = angular.module('sysBusLogModule', ['paginationService', 'anajaxService','agularValidate','innerPaginationService']);

sysBusLogModule.controller('sysBusLogController', function($scope, $http,pagination,anajax,innerPagination) {
	
	
	$scope.resultList={};//结果列表
	$scope.queryForm={};
	$scope.sysBusLogForm={};
	$scope.sysBusLogForm.bisfreeze=0;
	$scope.bisfreezeOps={1:"是",0:"否"};
	
	/**
	 * 查询
	 */
	var query = function(params) {
		var url = commonutil.actionPath + '/sys/BusLog/list_json';
		anajax.doajax(url, params, function(data) {
			$scope.resultList = data.resultList;
			pagination.setData(data.pagination);
			$scope.pagination = data.pagination; 
		});
	};
	
	query($scope.queryForm);
	
	/**
	 * 跳转到指定页
	 */
	$scope.goPage = function(selNum) {
		
		pagination.goPage(selNum);
		query($scope.pagination);
	};
	
	/**
	 * 上一页
	 */
	$scope.lastPage = function() {
		pagination.lastPage();
		query($scope.pagination);
	};
	
	/**
	 * 下一页
	 */
	$scope.nextPage = function() {
		pagination.nextPage();
		query($scope.pagination);
	};
	
	/**
	 * 点击查询
	 */
	$scope.doquery = function() {
		
		query($scope.queryForm);
	};
	
	$(function () { 
		   $('#startTime').datepicker({
			   format : 'yyyy-mm-dd',
				prevText : '<i class="fa fa-chevron-left"></i>',
				nextText : '<i class="fa fa-chevron-right"></i>',
				onSelect : function(selectedDate) {
					$('#endTime').datepicker('option', 'minDate', selectedDate);
				}
			});
		   
		   $('#endTime').datepicker({
			   format : 'yyyy-mm-dd',
				prevText : '<i class="fa fa-chevron-left"></i>',
				nextText : '<i class="fa fa-chevron-right"></i>',
				onSelect : function(selectedDate) {
					$('#startTime').datepicker('option', 'maxDate', selectedDate);
				}
			});
	})
	
});